<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
    <head> 
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <%@ include file="/WEB-INF/views/include/head.jsp"%>
    <link rel="stylesheet" href="${ctxStatic}/css/common_erp.css">
    <link rel="stylesheet" href="${ctxStatic}/css/layerSm.css">
    <script src="${ctxStatic}/jquery/jquery-1.9.1.min.js"></script>
    <script src="${ctxStatic}/js/layer.js"></script>
    <script src="${ctxStatic}/js/style.js"></script>
    <script>
    $(function(){
        $(".tabBox ul li").each(function(){
            var index=$(this).index();

            $(".tabBox ul li").eq(0).addClass("active");

            $(this).click(function(){

                $(this).addClass("active").siblings().removeClass("active");

                $(".tabBoxSm > .tabSm").eq(index).stop(true).show().siblings().stop(true).hide();
				
				var tableW = $(".tabBoxSm > .tabSm").eq(index).find('.tableHead').width();
				var tabodyH = $(".tabBoxSm > .tabSm").eq(index).find('.tableBody').height();
				var tableScrollH = $(".tabBoxSm > .tabSm").eq(index).find('.tableScroll').height();
				if(tabodyH>tableScrollH){
					$(".tabBoxSm > .tabSm").eq(index).find('.tableScroll').css('width',tableW + 18 + 'px')
				}else{
					$(".tabBoxSm > .tabSm").eq(index).find('.tableScroll').css('width','inherit')
				}

            })

        })

    });
    function excelExport() {
    	$("#inputForm").submit();
    }
    </script>
</head>
<body>
<c:set value="<%=ResourcesUtil.getConfig(\"reserver_meterial_ok\") %>" var="audit20"/>
<div class="layerHeader clearfix">
	<p class="headerTitle"><spring:message code="orderMateriel_show_head" /></p>
    <div class="headerButton clearfix">
        <shiro:hasPermission name="customization:nuclearmaterial:audit">
    	<button type="button" onclick="popup('800px','519px','${ctx}/customization/nuclearmaterial/audit?id=${orderMateriel.id}')"><spring:message code="orderMateriel_show_audit" /></button>
    	</shiro:hasPermission>
    	<shiro:hasPermission name="customization:nuclearmaterial:audit">
        <button type="button" onclick="popup('800px','519px','${ctx}/customization/nuclearmaterial/audit?id=${orderMateriel.id}&&onlyShow=1')"><spring:message code="orderMateriel_show_record" /></button>
        </shiro:hasPermission>
        <button type="button" onclick="excelExport();"><spring:message code="orderMateriel_create_btn_download" /></button>
        <c:if test="${orderMateriel.reserveMeterialStatus != audit20 }">
	        <shiro:hasPermission name="customization:nuclearmaterial:edit">
	        	<button type="button" onclick="window.location.href='${ctx}/customization/nuclearmaterial/form?id=${orderMateriel.id}'"><spring:message code="write_style_btn" /></button>
	        </shiro:hasPermission>
        </c:if>
        <button type="button" onclick="closeWin()"><spring:message code="btn_cancle" /></button>
    </div>
</div>
<div class="tabBox">
    <ul class="clearfix">
     	<li class="active"><spring:message code="orderMateriel_show_tab_info" /></li>
        <li><spring:message code="orderMateriel_show_tab_material" /></li>
    </ul>
</div>
<form id="inputForm" ACTION="${ctx}/customization/nuclearmaterial/exportFile" method="post">
<div class="tabBoxSm">
	<input type="hidden" name="indentNo" value="${orderMateriel.indentNo}"/>
	<input type="hidden" name="ognizationName" value="${orderMateriel.ognizationName}"/>
	<input type="hidden" name="indentIssueDate" value="<fmt:formatDate value="${orderMateriel.indentIssueDate}" pattern="yyyy-MM-dd" />"/>
	<input type="hidden" name="styleCustomerNo" value="${orderMateriel.styleCustomerNo}"/>
	<input type="hidden" name="styleNameCn" value="${orderMateriel.styleNameCn}"/>
	<input type="hidden" name="indentDeliveryDate" value="<fmt:formatDate value="${orderMateriel.indentDeliveryDate}" pattern="yyyy-MM-dd" />"/>
	<input type="hidden" name="indentQuantity" value="<fmt:formatNumber value="${orderMateriel.indentQuantity}" pattern="###0.#####"/>"/>
	<input type="hidden" name="unitCostNo" value="${orderMateriel.unitCostNo}"/>
	<input type="hidden" name="unitCost" value="<fmt:formatNumber value="${orderMateriel.unitCost}" pattern="###0.00#"/>"/>
	<input type="hidden" name="materialNum" value="<fmt:formatNumber value="${orderMateriel.materialNum}" pattern="###0"/>"/>
    <div class="tabSm smOrderBox">
        <div class="items clearfix">
            <!-- 合同单号(核料信息) -->
            <div class="col-33 clearfix">
                <p class="tit"><spring:message code="orderMateriel_show_indentNo" /></p>
                <p>${orderMateriel.indentNo}</p>
            </div>
            <!-- 客户(核料信息) -->
            <div class="col-33 clearfix">
                <p class="tit"><spring:message code="orderMateriel_show_ognizationName" /></p>
                <p>${orderMateriel.ognizationName}</p>
            </div>
            <!-- 签订日期(核料信息) -->
            <div class="col-33 clearfix">
                <p class="tit"><spring:message code="orderMateriel_show_indentIssueDate" /></p>
                <p><fmt:formatDate value="${orderMateriel.indentIssueDate}" pattern="yyyy-MM-dd" /></p>
            </div>
        </div>
        <div class="items clearfix">
            <!-- 款号(核料信息) -->
            <div class="col-33 clearfix ">
                <p class="tit"><spring:message code="orderMateriel_show_styleCustomerNo" /></p>
                <p>${orderMateriel.styleCustomerNo}</p>
            </div>
            <!-- 款式名称(核料信息) -->
            <div class="col-33 clearfix">
                <p class="tit"><spring:message code="orderMateriel_show_styleNameCn" /></p>
                <p>${orderMateriel.styleNameCn}</p>
            </div>
            <!-- 交货日期(核料信息) -->
            <div class="col-33 clearfix">
                <p class="tit"><spring:message code="orderMateriel_show_indentDeliveryDate" /></p>
                <p><fmt:formatDate value="${orderMateriel.indentDeliveryDate}" pattern="yyyy-MM-dd" /></p>
            </div>
        </div>
        <div class="items clearfix">
            <!-- 订单数量(核料信息) -->
            <div class="col-33 clearfix ">
                <p class="tit"><spring:message code="orderMateriel_show_indentQuantity" /></p>
                <p><fmt:formatNumber value="${orderMateriel.indentQuantity}" pattern="#,##0.#####"/></p>
            </div>
        </div>
        <div class="items clearfix">
            <!-- 单耗号(核料信息) -->
            <div class="col-33 clearfix">
                <p class="tit"><spring:message code="orderMateriel_show_unitCostNo" /></p>
                <p>${orderMateriel.unitCostNo}</p>
            </div>
            <!-- 单耗成本(核料信息) -->
            <div class="col-33 clearfix">
                <p class="tit"><spring:message code="orderMateriel_show_unitCost" /></p>
                <p><fmt:formatNumber value="${orderMateriel.unitCost}" pattern="#,##0.00#"/></p>
            </div>
            <!-- 物料数量(核料信息) -->
            <div class="col-33 clearfix">
                <p class="tit"><spring:message code="orderMateriel_show_materialNum" /></p>
                <p><fmt:formatNumber value="${orderMateriel.materialNum}" pattern="#,##0"/></p>
            </div>
        </div>
	</div>
    <div class="tabSm none">
    	<div class="tableArea" id="orderMaterialItem">
        	<div class="tableScrollSm" style="overflow: auto;height: 470px;width: 978px;">
        		<table cellpadding="0" class="tableHead">
                    <thead>
                    <tr>
                        <th class="tab-wltp"><spring:message code="orderMateriel_show_material_materialFile" /></th>
                        <th class="tab-wlmcbj"><spring:message code="orderMateriel_show_material_materialNameCn" /></th>
                        <th class="tab-wllb"><spring:message code="orderMateriel_show_material_materialTypeCd" /></th>
                        <th class="tab-wlys"><spring:message code="orderMateriel_show_material_materialColor" /></th>
                        <th class="tab-fk"><spring:message code="orderMateriel_show_material_materialSpec" /></th>
                        <th class="tab-dw"><spring:message code="orderMateriel_show_material_materialUnitCd" /></th>
                        <th class="tab-dh"><spring:message code="orderMateriel_show_material_materialCost" /></th>
                        <th class="tab-sh"><spring:message code="orderMateriel_show_material_materialPreLoss" /></th>
                        <th class="tab-sh"><spring:message code="orderMateriel_show_material_materialLoss" /></th>
                        <th class="tab-wltp"><spring:message code="orderMateriel_show_material_indentQuantity" /></th>
                        <th class="tab-sh"><spring:message code="orderMateriel_show_material_planMaterialLoss" /></th>
                        <th class="tab-wltp"><spring:message code="orderMateriel_show_material_purchaseReserveQuantity" /></th>
                        <th class="tab-wltp"><spring:message code="orderMateriel_show_material_orderMaterielDetail" /></th>
                    </tr>
                    </thead>
                </table>
                <table cellpadding="0" class="tableBody" id="tableOrderMateriel">
                <c:if test="${not empty orderMateriel.orderMaterielList}" >
                    <tbody>
                    <c:forEach items="${orderMateriel.orderMaterielList}" var="orderMate" varStatus="status">
                    <div class = "orderMaterial">
                    <tr class="parentTr">
                        <!-- 物料图片(面辅配料) -->
                        <td class="materialFile tab-wltp">
                           <c:if test="${not empty orderMate.materialFile}">
                                 <img src="${orderMate.materialFile}" class="wltp">
                           </c:if>
                           <c:if test="${empty orderMate.materialFile}">
                                 <img src="${ctxStatic}/images/pic-none.jpg" class="wltp">
                           </c:if>
                        </td>
                        <!-- 物料名称/编码(面辅配料) -->
                        <td class="tab-wlmcbj"><p>${orderMate.materialCode}</p><c:if test="${orderMate.materialNameCn != '' }"><br><p>${orderMate.materialNameCn}</p></c:if>
                        	<input type='hidden' name='orderMaterielList[${status.index}].materialCode' value="${orderMate.materialCode}">
                        	<input type='hidden' name='orderMaterielList[${status.index}].materialNameCn' value="${orderMate.materialNameCn}">
                        </td>
                        <!-- 物料类别(面辅配料) -->
                        <td class="tab-wllb"><p>${fns:getDictName(orderMate.materialTypeCd)}</p></td>
                        <!-- 物料颜色(面辅配料) -->
                        <td class="materialColor tab-wlys"><p>${orderMate.materialColor}</p>
                        	<input type='hidden' name='orderMaterielList[${status.index}].materialColor' value="${orderMate.materialColor}"></td>
                        <!-- 幅宽(面辅配料) -->
                        <td class="materialSpec tab-fk"><p>${orderMate.materialSpec}</p>
                        	<input type='hidden' name='orderMaterielList[${status.index}].materialSpec' value="${orderMate.materialSpec}"></td>
                        <!-- 单位(面辅配料) -->
                        <td class="tab-dw"><p>${fns:getDictName(orderMate.materialUnitCd)}</p>
                        	<input type='hidden' name='orderMaterielList[${status.index}].materialUnitCd' value="${fns:getDictName(orderMate.materialUnitCd)}"></td>
                        <!-- 单耗(面辅配料) -->
                        <td class="tab-dh"><p><fmt:formatNumber value="${orderMate.materialCost}" pattern="#,##0.####"/></p>
                        	<input type='hidden' name='orderMaterielList[${status.index}].materialCost' value="${orderMate.materialCost}"></td>
                        <!-- 损耗（%）(面辅配料) -->
                        <td class="tab-sh"><p><fmt:formatNumber value="${orderMate.materialPreLoss}" pattern="#,##0.###"/>%</p></td>
                        <!-- 含损耗单耗(面辅配料) -->
                        <td class="tab-sh"><p><fmt:formatNumber value="${orderMate.materialLoss}" pattern="#,##0.####"/></p>
                        	<input type='hidden' name='orderMaterielList[${status.index}].materialLoss' value="${orderMate.materialLoss}">
                        </td>
                        <!-- 服装数量(面辅配料) -->
                        <td class="tab-wltp"><p><fmt:formatNumber value="${orderMate.indentQuantity}" pattern="#,##0.#####"/></p>
                        	<input type='hidden' name='orderMaterielList[${status.index}].indentQuantity' value="${orderMate.indentQuantity}"></td>
                        <!-- 预订耗料数(面辅配料) -->
                        <td class="cge-planMaterialLoss tab-sh"><p><fmt:formatNumber value="${orderMate.planMaterialLoss}" pattern="#,##0.###"/></p>
                        	<input type='hidden' name='orderMaterielList[${status.index}].planMaterialLoss' value="${orderMate.planMaterialLoss}"></td>
                        <!-- 采购数量(面辅配料) -->
                        <td class="tab-wltp"><p><fmt:formatNumber value="${orderMate.purchaseReserveQuantity}" pattern="#,##0.####"/></p>
                        	<input type='hidden' name='orderMaterielList[${status.index}].purchaseReserveQuantity' value="${orderMate.purchaseReserveQuantity}"></td>
                        <!-- 核料明细(面辅配料) -->
                        <td class="tab-wltp"><p>
                        <c:if test="${orderMate.orderMaterielDetail eq 0}">
                            <p><spring:message code="orderMateriel_show_material_MaterielDetailNone" /></p>
                        </c:if>
                        <c:if test="${orderMate.orderMaterielDetail != 0}">
                            <p class="linkBox" onclick="popup('800px','519px','${ctx}/customization/nuclearmaterial/detail?index=${status.index}&&materialId=${orderMate.materialId}&&onlyShow=1')"><spring:message code="orderMateriel_show_material_MaterielDetailExist" /></p>
                        </c:if>
                        </p></td>
                        <td class="materialCode none">${orderMate.materialCode}</td>
                        <td class="materialNameCn none">${orderMate.materialNameCn}</td>
                        <td class="materialComposition none">${orderMate.materialComposition}</td>
                        <td class="materialQuantity none">${orderMate.materialQuantity}</td>
                        <td class = "addTable none">
                        <table  cellpadding="0" class="tableBody">
                          <tbody>
                          <c:forEach items="${orderMate.venderForm.materialPurchaseList}" var="materialPurchase" varStatus="purchaseStatus">
                             <tr>
							    <td style="width:50px"></td>
				                <td style="width:155px">${materialPurchase.venderNameCn}</td>
				                <td style="width:95px"><fmt:formatNumber value="${materialPurchase.purchaseReserveQuantity}" pattern="##0.####"/></td>
				                <td style="width:95px"><fmt:formatNumber value="${materialPurchase.purchaseUnitPrice}" pattern="##0.#####"/></td>
				                <td style="width:95px"><fmt:formatNumber value="${materialPurchase.purchaseTaxRebate}" pattern="##0.###"/></td>
				                <td style="width:95px"><fmt:formatNumber value="${materialPurchase.purchaseUnitCost}" pattern="##0.#####"/></td>
				                <td style="width:95px"><fmt:formatNumber value="${materialPurchase.purchasePrice}" pattern="##0.#####"/></td>
				                
				                <input type='hidden' name='orderMaterielList[${status.index}].venderForm.materialPurchaseList[${purchaseStatus.index}].venderNameCn' value="${materialPurchase.venderNameCn}">
				                <input type='hidden' name='orderMaterielList[${status.index}].venderForm.materialPurchaseList[${purchaseStatus.index}].purchaseUnitPrice' value="${materialPurchase.purchaseUnitPrice}">
				                <input type='hidden' name='orderMaterielList[${status.index}].venderForm.materialPurchaseList[${purchaseStatus.index}].purchaseTaxRebate' value="${materialPurchase.purchaseTaxRebate}">
				                <input type='hidden' name='orderMaterielList[${status.index}].venderForm.materialPurchaseList[${purchaseStatus.index}].purchasePrice' value="${materialPurchase.purchasePrice}">
	                       </tr>
	                       </c:forEach>
                          </tbody>
                        </table>   
                        </td>
                    </tr>
                    </div>
                    </c:forEach>
                    </tbody>
                </c:if>    
                </table>
            </div>
        </div>
    </div>
</div>
</form>
</body>
</html>